<%- include header.html -%>
<link rel="stylesheet" href="/css/admin/slide_edit.css">
<form class="form-horizontal" action="formpost" method="post" role="form" enctype="multipart/form-data">
    <div class="clearfix">
        <ol class="breadcrumb">
            <li><a href="#">轮播图</a></li>
            <li class="active">编辑</li>
        </ol>
        <div class="pull-right" role="group" aria-label="...">
            <a href="" class="btn btn-success">返回</a>
            <input type="submit" class="btn btn-primary" value="提交">
        </div>
    </div>
    <div class="form">
        <div class="form-group">
            <label for="slide-sel" class="control-label col-sm-1">类型</label>
            <div class="col-sm-4">
                <select class="form-control" id="slide-sel">
                    <option value="1" >链接</option>
                    <option value="2" selected>专题栏目</option>
                    <option value="3">应用</option>
                </select>
            </div>
        </div>
        <div class="form-group imgpreview">
            <label for="up_img" class="control-label col-sm-1">图片</label>
            <div id="imgdiv" class="">
                <img style="height: 347px;width: 980px" id="imgShow" src=""/>
            </div>
            <div class="clearfix"></div>
            <div class="filebtn">
                <button type="button" class="btn btn-primary">上传图片</button>
                <input type="file" id="up_img" name="file_name">
            </div>
        </div>
        <div class="form-group">
            <label for="slide-name" class="control-label col-sm-1">名称</label>
            <div class="col-sm-4">
                <input type="text" class="form-control" name="slide-name" id="slide-name" placeholder="请输入轮播名称" required>
            </div>
        </div>
        <!--专题栏目-->
        <div class="form-group zhuantilanmu">
            <label for="slide-zhuantiID" class="control-label col-sm-1">栏目ID</label>
            <div class="col-sm-4">
                <input readonly type="text" class="form-control" name="urls" id="slide-zhuantiID" placeholder="请选择栏目ID">
            </div>
            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#zhuantilanmuModal">选择专题栏目</button>
        </div>
        <!--、、专题栏目-->
        <div class="form-group app">
            <label for="slide-appID" class="control-label col-sm-1">应用ID</label>
            <div class="col-sm-4">
                <input readonly type="text" class="form-control" name="urls" id="slide-appID" placeholder="请选择应用ID">
            </div>
            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#appModal">选择应用</button>
        </div>
        <div class="form-group link">
            <label for="slide-link" class="control-label col-sm-1">链接</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" name="urls" id="slide-link" placeholder="请输入轮播链接">
            </div>
        </div>
        <div class="form-group">
            <label for="slide-info" class="control-label col-sm-1">备注</label>
            <div class="col-sm-6">
                <textarea class="form-control" name="slide-info" id="slide-info" placeholder="请输入轮播备注"></textarea>
            </div>
        </div>
    </div>
</form>
<!--轮播图编辑js-->
<script src="/js/admin/slide_edit.js"></script>
<!--、、轮播图编辑js-->
<!--图片上传js-->
<script src="/js/ext/uploadPreview.js"></script>
<script type="text/javascript">
    new uploadPreview({
        UpBtn: "up_img",
        DivShow: "imgdiv",
        ImgShow: "imgShow",
        callback: function () {
            //创建FormData对象
            var data = new FormData();
            var files = $("#up_img")[0].files;
            console.log(files);
            if(files){
                data.append("file", files[0]);
            }
            console.log(data);
            $.ajax({
                url:'uploadImg',
                type:'POST',
                data:data,
                cache: false,
                contentType: false,    //不可缺
                processData: false,    //不可缺
                success:function(data){

                }
            });
        }
    });
</script>
<!--、、图片上传js-->
<%- include footer.html -%>